//
//  ViewController.m
//  JMControl
//
//  Created by Zhuangyh on 16/1/7.
//  Copyright © 2016年 dooya. All rights reserved.
//

#import "ViewController.h"
#import "JMCircularSlider.h"
#import "JMSlider.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    JMCircularSlider *slider = [[JMCircularSlider alloc]initWithFrame:CGRectMake(60, 60, 200, 200)];
    slider.backgroundColor = [UIColor yellowColor];
    //Define Target-Action behaviour
//    [slider addTarget:self action:@selector(newValue:) forControlEvents:UIControlEventValueChanged];
    
    
    [self.view addSubview:slider];
    
//    JMSlider *slidera = [JMSlider appearance];
//    slidera.maximumTrackTintColor = [UIColor brownColor];
    
    JMSlider * slider2 = [[JMSlider alloc]initWithFrame:CGRectMake(0, 350, 375, 50)];
    slider2.continuous = NO;
//    slider2.minimumTrackTintColor = [UIColor greenColor];//
//    slider2.maximumTrackTintColor = [UIColor brownColor];
//    slider2.tintColor = [UIColor orangeColor];//滑动条的背景色
    slider2.backgroundColor = [UIColor yellowColor];
    slider2.widthOfSliderLine = 16;
    slider2.onlyStopInStartAndEnd = YES;
    
//    //设置未滑动位置背景图片
//    [slider2 setMinimumTrackImage:[UIImage imageNamed:@"stopBtn"] forState:UIControlStateNormal];
//    //设置已滑动位置背景图
//    [slider2 setMaximumTrackImage:[UIImage imageNamed:@"slider"] forState:UIControlStateNormal];
//    //设置滑块图标图片
//    [slider2 setThumbImage:[UIImage imageNamed:@"stopBtn"] forState:UIControlStateNormal];
//    //设置点击滑块状态图标
//    [slider2 setThumbImage:[UIImage imageNamed:@"main_slider_btn.png"] forState:UIControlStateHighlighted];
    
    //设置旋转90度
    slider2.transform = CGAffineTransformMakeRotation( M_PI * 0.5 );
    slider2.frame = CGRectMake(0, 90, 50, 200);
    [slider2 addTarget:self action:@selector(newValue:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:slider2];
}

- (void)newValue:(JMSlider *) sender {
    NSLog(@"%s:%f",__FUNCTION__,sender.value);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
